﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModelQuality.Metrics.Rules;
using ModelQuality.Metrics.Utils;

namespace ModelQuality.Metrics.Engine
{
    public class ValidationReport
    {
        public Activity Activity { get; private set; }

        public ValidationReport(Activity activity)
        {
            this.Activity = activity;
        }

        public int GetGlobalMark()
        {
            var average = Activity.GetAllRootRules().Where(rule => rule.HasBeenRun())
                                    .WeightedAverage(rule => rule.GetMark(), rule => rule.weight);
            return Convert.ToInt32(average);
        }
    }
}
